Errata for Mastering Regular Expressions Third Edition
http://regex.info/errata3.html
p370, last paragraph
Printed: (it renders LF and all the other non-newline…
Fixed: (it renders CR and all the other non-newline…
Reported by Alan Moore, 11-Oct-2006
p447, last paragraph
Printed: …, '+' is treated as '*?' and vice-versa
Fixed: …, '+' is treated as '+?' and vice-versa
Reported by Jan-Pieter Cornet, 14-Jan-2006
p481, mid-page regex
Printed: ^((?:<(\w++)[^>]*+(?<!/)>(?1)</\2>|[^<>]++|<\w[^>]*+/>)*+)$</tt>
Fixed: ^((?:<(\w++)[^>]*+(?<!/)>(?1)</\2>|[^<>]++|<\w[^>]*/>)*+)$</tt>
This is a pretty major error — the use of a possessive greedy quantifier on '[^>]' means that the '/' that follows can never match (since if there were a slash for the '/' to match, the '[^>]' would have consumed it). In an attempt to make the expression a bit more efficient, I made it incorrect, and that's very bad. If PHP had lazy possessive quantifiers, I could use them here, but it doesn't, so the thing to do is to drop the minor efficiency gains from the possessive quantifiers, and use normal greedy quantifiers. That way, it will at least be correct.
Reported by Jan-Pieter Cornet, 14-Jan-2006n
p482, middle paragraph
Printed: The third alternative, <\w[^>]*+/>, matches…
Fixed: The third alternative, <\w[^>]*/>, matches…
Reported by Jan-Pieter Cornet, 14-Jan-2006
p482, middle paragraph
Printed: As before, the use of a possessive quantifier here may be overkill but it certainly doesn't hurt.
Fixed: (that sentence removed)